<?php


namespace app\api\validate;

use think\Validate;

class User extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'nickname' => 'require',
        'sex' => 'require|number|between:1,2',
        'mobile' => 'require|number',
        'wechat_number' => 'require',
        'city' => 'require',
        'identity' => 'require',
        'topic' => 'require',
        'industry' => 'require',
        'name' => 'require',
        'id_cards' => 'require',
        'enclosure' => 'require',
        'status' => 'require|number|between:1,2',
        'qualifications_name' => 'require',
        'qualifications_path' => 'require',
        'primary_id' => 'require|number',
        'avatar' => 'require',
        'cards_id' => 'require',
        'title' => 'require',
        'content' => 'require',
        'file' => 'require',
        'content_ids' => 'require',
        'collection_ids' => 'require',
        'tabType' => 'require|number|between:1,2',
        'username' => 'require',
        'wxh' => 'require',
        'address' => 'require',
        'id_card' => 'require',
        'opening_bank' => 'require',
        'bank_card' => 'require',
        'price' => 'require',
        'note' => 'require',
        'introduce' => 'require',
        'user_id' => 'require',
        'fileParams' => 'require',
        'path_file_name' => 'require',
        'filename' => 'require',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'status.require' => '请选择是否公开',
        'status.number' => '选择的是否公开格式不正确',
        'status.between' => '选择的是否公开范围值在1~2之间',
        'nickname.require' => '请输入姓名',
        'sex.require' => '请选择性别',
        'sex.number' => '选择的性别格式不正确',
        'sex.between' => '选择的性别范围值在1~2之间',
        'mobile.require' => '请输入手机号',
        'mobile.number' => '输入的手机号格式不正确',
        'wechat_number.require' => '请输入微信号',
        'city.require' => '请输入所在城市',
        'identity.require' => '请选择当前身份',
        'topic.require' => '请选择擅长课题',
        'industry.require' => '请选择擅长行业',
        'name.require' => '请选输入实名认证的真实姓名',
        'id_cards.require' => '请选输入实名认证的身份证号',
        'enclosure.require' => '请上传附件简介',
        'qualifications_name.require' => '请输入资质名称',
        'qualifications_path.require' => '请上传资质附件',
        'primary_id.require' => '缺少ID',
        'primary_id.number' => 'ID格式不正确',
        'avatar.require' => '请上传头像',
        'cards_id.require' => '缺少会员ID',
        'title.require' => '缺少标题',
        'content.require' => '缺少内容',
        'file.require' => '缺少文件',
        'collection_ids.require' => '缺少合集ID',
        'content_ids.require' => '缺少列表内容ID',
        'tabType.require' => '请选择搜索类型',
        'tabType.number' => '搜索类型格式不正确',
        'tabType.between' => '搜索类型范围值在1~2之间',
        'username.require' => '请输入姓名',
        'wxh.require' => '请输入微信号',
        'address.require' => '请输入城市地址',
        'id_card.require' => '请输入身份证',
        'opening_bank.require' => '请输入开户行',
        'bank_card.require' => '请输入银行卡',
        'price.require' => '请输入课酬',
        'note.require' => '请输入备注',
        'introduce.require' => '请输入详细介绍',
        'user_id.require' => '缺少分享者的用户ID',
        'fileParams.require' => '缺少批量上传的文件',
        'path_file_name.require' => '缺少上传的资质文件名称',
        'filename.require' => '缺少附件名称',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'setUserInfo' => ['nickname'], // 'avatar'，'sex', 'mobile', 'wechat_number', 'city', 'identity', 'topic', 'industry', 'enclosure'
        'setUserQualifications' => ['qualifications_name'],
        'setUserQualificationsPath' => ['qualifications_path', 'primary_id', 'path_file_name'],
        'getUserQualifications' => ['primary_id'],
        'delQualifications' => ['primary_id'],
        'payMemberOrder' => ['cards_id'],
        'addContent' => ['title', 'content'],
        'updateAuthStatus' => ['content_ids', 'status'],
        'delContent' => ['primary_id'],
        'updateContentName' => ['primary_id', 'title'],
        'joinCollection' => ['collection_ids', 'primary_id'],
        'createCollection' => ['title'],
        'delCollection' => ['collection_ids'],
        'updateCollectionName' => ['title', 'primary_id'],
        'getCollectionContent' => ['primary_id'],
        'delCollectionContent' => ['primary_id', 'content_ids'],
        'collectionAddContent' => ['primary_id', 'content_ids'],
        'userHomeSearch' => ['tabType'],
        'trainingCheckIn' => ['images', 'title', 'content'], // city
        'getTrainingCheckInPoster' => ['primary_id'],
        'addNewOtherInformation' => ['username'], // 'file', 'filename',, 'wxh', 'address', 'sex', 'id_card', 'opening_bank', 'bank_card', 'price', 'topic', 'industry', 'note', 'introduce', 'status', 'mobile'
        'joinSuccessOrFail' => ['user_id'],
        'uploadContentFileV2' => ['fileParams'],
        'setOpen' => ['status']
    ];
}